package com.small.push.config;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * 主题配置
 * @author dingyou
 * @version 1.0
 * @date 2019-01-10
 */
public class Topic {
    /** 主题名字符串*/
    private String topic;
    /** 消息消息的线程数,默认为1. 注意:此线程数仅为从队列中取出消息的线程数,并非实际发送消息的线程数,一般情况不建议修改此参数*/
    private int consumeThreads = 1;

    public String getTopic() {
        return topic;
    }

    public Topic setTopic(String topic) {
        this.topic = topic;
        return this;
    }

    public int getConsumeThreads() {
        return consumeThreads;
    }

    public Topic setConsumeThreads(int consumeThreads) {
        this.consumeThreads = consumeThreads;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        Topic topic1 = (Topic) o;

        return new EqualsBuilder()
                .append(topic, topic1.topic)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(topic)
                .toHashCode();
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
